import requests


class Ihrm(object):
    @classmethod
    def ihrm_login(cls, json):
        li = requests.post(url="http://ihrm2-test.itheima.net/api/sys/login",
                           json=json)
        return li

    @classmethod
    def ihrm_add(cls, headers, json):
        li = requests.post(url="http://ihrm2-test.itheima.net/api/sys/user",
                           headers=headers, json=json)
        return li


if __name__ == '__main__':
    json = {
        "mobile": "13800000002",
        "password": "123456"
    }
    li = Ihrm.ihrm_login(json)
    print(li.json())
    data = {"Content-Type": "application/json",
            "Authorization": "Bearer 24e18942-00d4-474a-bfba-12b9a67e74f5"}
    code = {
        "username": "小猪佩奇1",
        "mobile": "51591391018",
        "workNumber": "9500"
    }
    xu = Ihrm.ihrm_add(data,code)
    print(xu.json())
